﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using BlogManager.Properties;
using BlogManager.Configuration;
using System.Threading;
using System.Globalization;

namespace BlogManager
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
            bool firstExecution = Settings.Default.FirstExecution;
            if (Settings.Default.FirstExecution)
            { 
                // mostro il disclaimer
                AboutBox1 disclaimer = new AboutBox1();
                disclaimer.DisclaimerMode = true;
                if (disclaimer.ShowDialog() != DialogResult.OK)
                    return;

                Settings.Default.Upgrade();
                Settings.Default.FirstExecution = false;
                Settings.Default.Save();
            }
            Application.Run(new MainForm());
        }

        static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MsgBox.Error(e.Exception.Message);
        }
    }
}